package Day05;

import java.util.Arrays;
import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        /*//声明整数数组arr，包含10个元素，每个元素都是int类型，默认值为0
        int [] arr= new int[10];
        int [] arr1= new int[3];
        int [] arr2=new int[]{2,5,8};
        int [] arr3;
        arr3= new int[]{2,5,8};
        int [] arr4={2,5,8};
        System.out.println("数组长度"+arr.length);

        int [] arr5=new int[3];
        System.out.println(arr5[1]);
        arr5[0] = 100;
        arr5[1] = 200;
        arr5[2] = 300;
        System.out.println(Arrays.toString(arr5));
        System.out.println(arr5[arr5.length-1]);
*/
       /* int [] arr5=new int[10];int max = arr5[0];
        for (int i=0;i< arr5.length;i++){
            arr5[i]=(int)(Math.random()*99);
            System.out.println(arr5[i]);
            if (arr5[i]>max){
                max = arr5[i];
            }
        }System.out.println("     "+max);*/

        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 99);
            System.out.print(arr[i]+"\t");
        }
        System.out.println();
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
        System.out.println();
        for (int i = arr.length-1; i >=0; i--) {
            System.out.print(arr[i]+"\t");
        }
        System.out.println(arr[0]);
    }
}
